home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / Speech.a < prev    next >
Encoding:
Text File  |  1996-01-24  |  11.4 KB  |  571 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Speech.a
  3. ;
  4. ;    Contains:    Speech Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__SPEECH__') = 'UNDEFINED' THEN
  21. __SPEECH__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__MEMORY__') = 'UNDEFINED' THEN
  30.     include 'Memory.a'
  31.     ENDIF
  32. ;        include 'MixedMode.a'                                        ;
  33.  
  34.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  35.     include 'Files.a'
  36.     ENDIF
  37. ;        include 'OSUtils.a'                                        ;
  38. ;        include 'Finder.a'                                            ;
  39.  
  40. kTextToSpeechSynthType            EQU        'ttsc'
  41. kTextToSpeechVoiceType            EQU        'ttvd'
  42. kTextToSpeechVoiceFileType        EQU        'ttvf'
  43. kTextToSpeechVoiceBundleType    EQU        'ttvb'
  44.  
  45. kNoEndingProsody                EQU        1
  46. kNoSpeechInterrupt                EQU        2
  47. kPreflightThenPause                EQU        4
  48.  
  49. kImmediate                        EQU        0
  50. kEndOfWord                        EQU        1
  51. kEndOfSentence                    EQU        2
  52.  
  53. ;------------------------------------------
  54. ; GetSpeechInfo & SetSpeechInfo selectors    
  55. ;------------------------------------------
  56. soStatus                        EQU        'stat'
  57. soErrors                        EQU        'erro'
  58. soInputMode                        EQU        'inpt'
  59. soCharacterMode                    EQU        'char'
  60. soNumberMode                    EQU        'nmbr'
  61. soRate                            EQU        'rate'
  62. soPitchBase                        EQU        'pbas'
  63. soPitchMod                        EQU        'pmod'
  64. soVolume                        EQU        'volm'
  65. soSynthType                        EQU        'vers'
  66. soRecentSync                    EQU        'sync'
  67. soPhonemeSymbols                EQU        'phsy'
  68. soCurrentVoice                    EQU        'cvox'
  69. soCommandDelimiter                EQU        'dlim'
  70. soReset                            EQU        'rset'
  71. soCurrentA5                        EQU        'myA5'
  72. soRefCon                        EQU        'refc'
  73. soTextDoneCallBack                EQU        'tdcb'
  74. soSpeechDoneCallBack            EQU        'sdcb'
  75. soSyncCallBack                    EQU        'sycb'
  76. soErrorCallBack                    EQU        'ercb'
  77. soPhonemeCallBack                EQU        'phcb'
  78. soWordCallBack                    EQU        'wdcb'
  79. soSynthExtension                EQU        'xtnd'
  80. soSoundOutput                    EQU        'sndo'
  81.  
  82. ;------------------------------------------
  83. ; Speaking Mode Constants                     
  84. ;------------------------------------------
  85. modeText                        EQU        'TEXT'                ; input mode constants                     
  86. modePhonemes                    EQU        'PHON'
  87. modeNormal                        EQU        'NORM'                ; character mode and number mode constants 
  88. modeLiteral                        EQU        'LTRL'
  89.  
  90. soVoiceDescription                EQU        'info'
  91. soVoiceFile                        EQU        'fref'
  92.  
  93. SpeechChannelRecord     RECORD    0
  94. data                     ds.l   1        ; offset: $0 (0)
  95. sizeof                     EQU *            ; size:   $4 (4)
  96.                         ENDR
  97.  
  98. ; typedef struct SpeechChannelRecord  SpeechChannelRecord
  99. ; typedef SpeechChannelRecord  *SpeechChannel
  100. VoiceSpec                 RECORD    0
  101. creator                     ds.l   1        ; offset: $0 (0)
  102. id                         ds.l   1        ; offset: $4 (4)
  103. sizeof                     EQU *            ; size:   $8 (8)
  104.                         ENDR
  105.  
  106. ; typedef struct VoiceSpec     VoiceSpec
  107.  
  108. kNeuter                            EQU        0
  109. kMale                            EQU        1
  110. kFemale                            EQU        2
  111.  
  112. VoiceDescription         RECORD    0
  113. length                     ds.l   1        ; offset: $0 (0)
  114. voice                     ds     VoiceSpec ; offset: $4 (4)
  115. version                     ds.l   1        ; offset: $C (12)
  116. name                     ds.l   16        ; offset: $10 (16)
  117. comment                     ds.l   64        ; offset: $50 (80)
  118. gender                     ds.w   1        ; offset: $150 (336)
  119. age                         ds.w   1        ; offset: $152 (338)
  120. script                     ds.w   1        ; offset: $154 (340)
  121. language                 ds.w   1        ; offset: $156 (342)
  122. region                     ds.w   1        ; offset: $158 (344)
  123. reserved                 ds.l   4        ; offset: $15A (346)
  124. sizeof                     EQU *            ; size:   $16A (362)
  125.                         ENDR
  126.  
  127. ; typedef struct VoiceDescription  VoiceDescription
  128. VoiceFileInfo             RECORD    0
  129. fileSpec                 ds     FSSpec    ; offset: $0 (0)
  130. resID                     ds.w   1        ; offset: $46 (70)
  131. sizeof                     EQU *            ; size:   $48 (72)
  132.                         ENDR
  133.  
  134. ; typedef struct VoiceFileInfo  VoiceFileInfo
  135. SpeechStatusInfo         RECORD    0
  136. outputBusy                 ds.b   1        ; offset: $0 (0)
  137. outputPaused             ds.b   1        ; offset: $1 (1)
  138. inputBytesLeft             ds.l   1        ; offset: $2 (2)
  139. phonemeCode                 ds.w   1        ; offset: $6 (6)
  140. sizeof                     EQU *            ; size:   $8 (8)
  141.                         ENDR
  142.  
  143. ; typedef struct SpeechStatusInfo  SpeechStatusInfo
  144. SpeechErrorInfo         RECORD    0
  145. count                     ds.w   1        ; offset: $0 (0)
  146. oldest                     ds.w   1        ; offset: $2 (2)
  147. oldPos                     ds.l   1        ; offset: $4 (4)
  148. newest                     ds.w   1        ; offset: $8 (8)
  149. newPos                     ds.l   1        ; offset: $A (10)
  150. sizeof                     EQU *            ; size:   $E (14)
  151.                         ENDR
  152.  
  153. ; typedef struct SpeechErrorInfo  SpeechErrorInfo
  154. SpeechVersionInfo         RECORD    0
  155. synthType                 ds.l   1        ; offset: $0 (0)
  156. synthSubType             ds.l   1        ; offset: $4 (4)
  157. synthManufacturer         ds.l   1        ; offset: $8 (8)
  158. synthFlags                 ds.l   1        ; offset: $C (12)
  159. synthVersion             ds     NumVersion ; offset: $10 (16)
  160. sizeof                     EQU *            ; size:   $14 (20)
  161.                         ENDR
  162.  
  163. ; typedef struct SpeechVersionInfo  SpeechVersionInfo
  164. PhonemeInfo             RECORD    0
  165. opcode                     ds.w   1        ; offset: $0 (0)
  166. phStr                     ds.l   4        ; offset: $2 (2)
  167. exampleStr                 ds.l   8        ; offset: $12 (18)
  168. hiliteStart                 ds.w   1        ; offset: $32 (50)
  169. hiliteEnd                 ds.w   1        ; offset: $34 (52)
  170. sizeof                     EQU *            ; size:   $36 (54)
  171.                         ENDR
  172.  
  173. ; typedef struct PhonemeInfo  PhonemeInfo
  174. PhonemeDescriptor         RECORD    0
  175. phonemeCount             ds.w   1        ; offset: $0 (0)
  176. thePhonemes                 ds     PhonemeInfo ; offset: $2 (2)
  177. sizeof                     EQU *            ; size:   $38 (56)
  178.                         ENDR
  179.  
  180. ; typedef struct PhonemeDescriptor  PhonemeDescriptor
  181. SpeechXtndData             RECORD    0
  182. synthCreator             ds.l   1        ; offset: $0 (0)
  183. synthData                 ds.b   2        ; offset: $4 (4)
  184. sizeof                     EQU *            ; size:   $6 (6)
  185.                         ENDR
  186.  
  187. ; typedef struct SpeechXtndData  SpeechXtndData
  188. DelimiterInfo             RECORD    0
  189. startDelimiter             ds.b   2        ; offset: $0 (0)
  190. endDelimiter             ds.b   2        ; offset: $2 (2)
  191. sizeof                     EQU *            ; size:   $4 (4)
  192.                         ENDR
  193.  
  194. ; typedef struct DelimiterInfo  DelimiterInfo
  195. ;
  196. ; pascal NumVersion SpeechManagerVersion(void)
  197. ;
  198.     IF ¬ GENERATINGCFM THEN
  199.         Macro
  200.         _SpeechManagerVersion
  201.             dc.w     $203C
  202.             dc.w     $0000
  203.             dc.w     $000C
  204.             dc.w     $A800
  205.         EndM
  206.     ELSE
  207.         IMPORT_CFM_FUNCTION    SpeechManagerVersion
  208.     ENDIF
  209.  
  210. ;
  211. ; pascal OSErr MakeVoiceSpec(OSType creator, OSType id, VoiceSpec *voice)
  212. ;
  213.     IF ¬ GENERATINGCFM THEN
  214.         Macro
  215.         _MakeVoiceSpec
  216.             dc.w     $203C
  217.             dc.w     $0604
  218.             dc.w     $000C
  219.             dc.w     $A800
  220.         EndM
  221.     ELSE
  222.         IMPORT_CFM_FUNCTION    MakeVoiceSpec
  223.     ENDIF
  224.  
  225. ;
  226. ; pascal OSErr CountVoices(short *numVoices)
  227. ;
  228.     IF ¬ GENERATINGCFM THEN
  229.         Macro
  230.         _CountVoices
  231.             dc.w     $203C
  232.             dc.w     $0108
  233.             dc.w     $000C
  234.             dc.w     $A800
  235.         EndM
  236.     ELSE
  237.         IMPORT_CFM_FUNCTION    CountVoices
  238.     ENDIF
  239.  
  240. ;
  241. ; pascal OSErr GetIndVoice(short index, VoiceSpec *voice)
  242. ;
  243.     IF ¬ GENERATINGCFM THEN
  244.         Macro
  245.         _GetIndVoice
  246.             dc.w     $203C
  247.             dc.w     $030C
  248.             dc.w     $000C
  249.             dc.w     $A800
  250.         EndM
  251.     ELSE
  252.         IMPORT_CFM_FUNCTION    GetIndVoice
  253.     ENDIF
  254.  
  255. ;
  256. ; pascal OSErr GetVoiceDescription(VoiceSpec *voice, VoiceDescription *info, long infoLength)
  257. ;
  258.     IF ¬ GENERATINGCFM THEN
  259.         Macro
  260.         _GetVoiceDescription
  261.             dc.w     $203C
  262.             dc.w     $0610
  263.             dc.w     $000C
  264.             dc.w     $A800
  265.         EndM
  266.     ELSE
  267.         IMPORT_CFM_FUNCTION    GetVoiceDescription
  268.     ENDIF
  269.  
  270. ;
  271. ; pascal OSErr GetVoiceInfo(VoiceSpec *voice, OSType selector, void *voiceInfo)
  272. ;
  273.     IF ¬ GENERATINGCFM THEN
  274.         Macro
  275.         _GetVoiceInfo
  276.             dc.w     $203C
  277.             dc.w     $0614
  278.             dc.w     $000C
  279.             dc.w     $A800
  280.         EndM
  281.     ELSE
  282.         IMPORT_CFM_FUNCTION    GetVoiceInfo
  283.     ENDIF
  284.  
  285. ;
  286. ; pascal OSErr NewSpeechChannel(VoiceSpec *voice, SpeechChannel *chan)
  287. ;
  288.     IF ¬ GENERATINGCFM THEN
  289.         Macro
  290.         _NewSpeechChannel
  291.             dc.w     $203C
  292.             dc.w     $0418
  293.             dc.w     $000C
  294.             dc.w     $A800
  295.         EndM
  296.     ELSE
  297.         IMPORT_CFM_FUNCTION    NewSpeechChannel
  298.     ENDIF
  299.  
  300. ;
  301. ; pascal OSErr DisposeSpeechChannel(SpeechChannel chan)
  302. ;
  303.     IF ¬ GENERATINGCFM THEN
  304.         Macro
  305.         _DisposeSpeechChannel
  306.             dc.w     $203C
  307.             dc.w     $021C
  308.             dc.w     $000C
  309.             dc.w     $A800
  310.         EndM
  311.     ELSE
  312.         IMPORT_CFM_FUNCTION    DisposeSpeechChannel
  313.     ENDIF
  314.  
  315. ;
  316. ; pascal OSErr SpeakString(StringPtr s)
  317. ;
  318.     IF ¬ GENERATINGCFM THEN
  319.         Macro
  320.         _SpeakString
  321.             dc.w     $203C
  322.             dc.w     $0220
  323.             dc.w     $000C
  324.             dc.w     $A800
  325.         EndM
  326.     ELSE
  327.         IMPORT_CFM_FUNCTION    SpeakString
  328.     ENDIF
  329.  
  330. ;
  331. ; pascal OSErr SpeakText(SpeechChannel chan, Ptr textBuf, long textBytes)
  332. ;
  333.     IF ¬ GENERATINGCFM THEN
  334.         Macro
  335.         _SpeakText
  336.             dc.w     $203C
  337.             dc.w     $0624
  338.             dc.w     $000C
  339.             dc.w     $A800
  340.         EndM
  341.     ELSE
  342.         IMPORT_CFM_FUNCTION    SpeakText
  343.     ENDIF
  344.  
  345. ;
  346. ; pascal OSErr SpeakBuffer(SpeechChannel chan, Ptr textBuf, long textBytes, long controlFlags)
  347. ;
  348.     IF ¬ GENERATINGCFM THEN
  349.         Macro
  350.         _SpeakBuffer
  351.             dc.w     $203C
  352.             dc.w     $0828
  353.             dc.w     $000C
  354.             dc.w     $A800
  355.         EndM
  356.     ELSE
  357.         IMPORT_CFM_FUNCTION    SpeakBuffer
  358.     ENDIF
  359.  
  360. ;
  361. ; pascal OSErr StopSpeech(SpeechChannel chan)
  362. ;
  363.     IF ¬ GENERATINGCFM THEN
  364.         Macro
  365.         _StopSpeech
  366.             dc.w     $203C
  367.             dc.w     $022C
  368.             dc.w     $000C
  369.             dc.w     $A800
  370.         EndM
  371.     ELSE
  372.         IMPORT_CFM_FUNCTION    StopSpeech
  373.     ENDIF
  374.  
  375. ;
  376. ; pascal OSErr StopSpeechAt(SpeechChannel chan, long whereToStop)
  377. ;
  378.     IF ¬ GENERATINGCFM THEN
  379.         Macro
  380.         _StopSpeechAt
  381.             dc.w     $203C
  382.             dc.w     $0430
  383.             dc.w     $000C
  384.             dc.w     $A800
  385.         EndM
  386.     ELSE
  387.         IMPORT_CFM_FUNCTION    StopSpeechAt
  388.     ENDIF
  389.  
  390. ;
  391. ; pascal OSErr PauseSpeechAt(SpeechChannel chan, long whereToPause)
  392. ;
  393.     IF ¬ GENERATINGCFM THEN
  394.         Macro
  395.         _PauseSpeechAt
  396.             dc.w     $203C
  397.             dc.w     $0434
  398.             dc.w     $000C
  399.             dc.w     $A800
  400.         EndM
  401.     ELSE
  402.         IMPORT_CFM_FUNCTION    PauseSpeechAt
  403.     ENDIF
  404.  
  405. ;
  406. ; pascal OSErr ContinueSpeech(SpeechChannel chan)
  407. ;
  408.     IF ¬ GENERATINGCFM THEN
  409.         Macro
  410.         _ContinueSpeech
  411.             dc.w     $203C
  412.             dc.w     $0238
  413.             dc.w     $000C
  414.             dc.w     $A800
  415.         EndM
  416.     ELSE
  417.         IMPORT_CFM_FUNCTION    ContinueSpeech
  418.     ENDIF
  419.  
  420. ;
  421. ; pascal short SpeechBusy(void)
  422. ;
  423.     IF ¬ GENERATINGCFM THEN
  424.         Macro
  425.         _SpeechBusy
  426.             dc.w     $203C
  427.             dc.w     $003C
  428.             dc.w     $000C
  429.             dc.w     $A800
  430.         EndM
  431.     ELSE
  432.         IMPORT_CFM_FUNCTION    SpeechBusy
  433.     ENDIF
  434.  
  435. ;
  436. ; pascal short SpeechBusySystemWide(void)
  437. ;
  438.     IF ¬ GENERATINGCFM THEN
  439.         Macro
  440.         _SpeechBusySystemWide
  441.             dc.w     $203C
  442.             dc.w     $0040
  443.             dc.w     $000C
  444.             dc.w     $A800
  445.         EndM
  446.     ELSE
  447.         IMPORT_CFM_FUNCTION    SpeechBusySystemWide
  448.     ENDIF
  449.  
  450. ;
  451. ; pascal OSErr SetSpeechRate(SpeechChannel chan, Fixed rate)
  452. ;
  453.     IF ¬ GENERATINGCFM THEN
  454.         Macro
  455.         _SetSpeechRate
  456.             dc.w     $203C
  457.             dc.w     $0444
  458.             dc.w     $000C
  459.             dc.w     $A800
  460.         EndM
  461.     ELSE
  462.         IMPORT_CFM_FUNCTION    SetSpeechRate
  463.     ENDIF
  464.  
  465. ;
  466. ; pascal OSErr GetSpeechRate(SpeechChannel chan, Fixed *rate)
  467. ;
  468.     IF ¬ GENERATINGCFM THEN
  469.         Macro
  470.         _GetSpeechRate
  471.             dc.w     $203C
  472.             dc.w     $0448
  473.             dc.w     $000C
  474.             dc.w     $A800
  475.         EndM
  476.     ELSE
  477.         IMPORT_CFM_FUNCTION    GetSpeechRate
  478.     ENDIF
  479.  
  480. ;
  481. ; pascal OSErr SetSpeechPitch(SpeechChannel chan, Fixed pitch)
  482. ;
  483.     IF ¬ GENERATINGCFM THEN
  484.         Macro
  485.         _SetSpeechPitch
  486.             dc.w     $203C
  487.             dc.w     $044C
  488.             dc.w     $000C
  489.             dc.w     $A800
  490.         EndM
  491.     ELSE
  492.         IMPORT_CFM_FUNCTION    SetSpeechPitch
  493.     ENDIF
  494.  
  495. ;
  496. ; pascal OSErr GetSpeechPitch(SpeechChannel chan, Fixed *pitch)
  497. ;
  498.     IF ¬ GENERATINGCFM THEN
  499.         Macro
  500.         _GetSpeechPitch
  501.             dc.w     $203C
  502.             dc.w     $0450
  503.             dc.w     $000C
  504.             dc.w     $A800
  505.         EndM
  506.     ELSE
  507.         IMPORT_CFM_FUNCTION    GetSpeechPitch
  508.     ENDIF
  509.  
  510. ;
  511. ; pascal OSErr SetSpeechInfo(SpeechChannel chan, OSType selector, void *speechInfo)
  512. ;
  513.     IF ¬ GENERATINGCFM THEN
  514.         Macro
  515.         _SetSpeechInfo
  516.             dc.w     $203C
  517.             dc.w     $0654
  518.             dc.w     $000C
  519.             dc.w     $A800
  520.         EndM
  521.     ELSE
  522.         IMPORT_CFM_FUNCTION    SetSpeechInfo
  523.     ENDIF
  524.  
  525. ;
  526. ; pascal OSErr GetSpeechInfo(SpeechChannel chan, OSType selector, void *speechInfo)
  527. ;
  528.     IF ¬ GENERATINGCFM THEN
  529.         Macro
  530.         _GetSpeechInfo
  531.             dc.w     $203C
  532.             dc.w     $0658
  533.             dc.w     $000C
  534.             dc.w     $A800
  535.         EndM
  536.     ELSE
  537.         IMPORT_CFM_FUNCTION    GetSpeechInfo
  538.     ENDIF
  539.  
  540. ;
  541. ; pascal OSErr TextToPhonemes(SpeechChannel chan, Ptr textBuf, long textBytes, Handle phonemeBuf, long *phonemeBytes)
  542. ;
  543.     IF ¬ GENERATINGCFM THEN
  544.         Macro
  545.         _TextToPhonemes
  546.             dc.w     $203C
  547.             dc.w     $0A5C
  548.             dc.w     $000C
  549.             dc.w     $A800
  550.         EndM
  551.     ELSE
  552.         IMPORT_CFM_FUNCTION    TextToPhonemes
  553.     ENDIF
  554.  
  555. ;
  556. ; pascal OSErr UseDictionary(SpeechChannel chan, Handle dictionary)
  557. ;
  558.     IF ¬ GENERATINGCFM THEN
  559.         Macro
  560.         _UseDictionary
  561.             dc.w     $203C
  562.             dc.w     $0460
  563.             dc.w     $000C
  564.             dc.w     $A800
  565.         EndM
  566.     ELSE
  567.         IMPORT_CFM_FUNCTION    UseDictionary
  568.     ENDIF
  569.  
  570.     ENDIF ; __SPEECH__
  571.